package com.member.shop.service.impl;

import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizGradeInfo;
import com.member.shop.mapper.SysBizGradeInfoMapper;
import com.member.shop.service.ISysBizGradeInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户等级Service业务层处理
 *
 * @author thomas
 * @date 2024-06-28
 */
@Service
public class SysBizGradeInfoServiceImpl implements ISysBizGradeInfoService {
    @Resource
    private SysBizGradeInfoMapper sysBizGradeInfoMapper;

    /**
     * 查询用户等级
     *
     * @param id 用户等级主键
     * @return 用户等级
     */
    @Override
    public SysBizGradeInfo selectSysBizGradeInfoById(Long id) {
        return sysBizGradeInfoMapper.selectSysBizGradeInfoById(id);
    }

    @Override
    public SysBizGradeInfo selectSysBizGradeInfoByGrade(Integer gradeNo) {
        return sysBizGradeInfoMapper.selectSysBizGradeInfoByGrade(gradeNo);
    }

    /**
     * 查询用户等级列表
     *
     * @param sysBizGradeInfo 用户等级
     * @return 用户等级
     */
    @Override
    public List<SysBizGradeInfo> selectSysBizGradeInfoList(SysBizGradeInfo sysBizGradeInfo) {
        return sysBizGradeInfoMapper.selectSysBizGradeInfoList(sysBizGradeInfo);
    }

    @Override
    public List<SysBizGradeInfo> selectSysBizGradeInfoListByIntegral(Long startIntegral, Long endIntegral) {
        return sysBizGradeInfoMapper.selectSysBizGradeInfoListByIntegral(startIntegral, endIntegral);
    }

    /**
     * 新增用户等级
     *
     * @param sysBizGradeInfo 用户等级
     * @return 结果
     */
    @Override
    public int insertSysBizGradeInfo(SysBizGradeInfo sysBizGradeInfo) {
        sysBizGradeInfo.setCreateTime(DateUtils.getNowDate());
        return sysBizGradeInfoMapper.insertSysBizGradeInfo(sysBizGradeInfo);
    }

    /**
     * 修改用户等级
     *
     * @param sysBizGradeInfo 用户等级
     * @return 结果
     */
    @Override
    public int updateSysBizGradeInfo(SysBizGradeInfo sysBizGradeInfo) {
        sysBizGradeInfo.setUpdateTime(DateUtils.getNowDate());
        return sysBizGradeInfoMapper.updateSysBizGradeInfo(sysBizGradeInfo);
    }

    /**
     * 批量删除用户等级
     *
     * @param ids 需要删除的用户等级主键
     * @return 结果
     */
    @Override
    public int deleteSysBizGradeInfoByIds(Long[] ids) {
        return sysBizGradeInfoMapper.deleteSysBizGradeInfoByIds(ids);
    }

    @Override
    public int deleteSysBizGradeInfoByGrade(Integer gradeNo) {
        return sysBizGradeInfoMapper.deleteSysBizGradeInfoByGrade(gradeNo);
    }

    /**
     * 删除用户等级信息
     *
     * @param id 用户等级主键
     * @return 结果
     */
    @Override
    public int deleteSysBizGradeInfoById(Long id) {
        return sysBizGradeInfoMapper.deleteSysBizGradeInfoById(id);
    }
}
